package com.example.leetcode.bfs;

import com.example.leetcode.bfs.common.BFSUtils;
import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution226 {
    public TreeNode invertTree(TreeNode root) {
//        return TreeUtils.invertTree(root);
        return BFSUtils.invertTree(root);
    }
}

public class leetcode226 {
    public static void main(String[] args) {
        Solution226 solution226 = new Solution226();
        Integer[] root = {4, 2, 7, 1, 3, 6, 9};
        test226(solution226, root);
    }

    private static void test226(Solution226 solution226, Integer[] root) {
        TreeNode treeNode = solution226.invertTree(TreeUtils.generateLeetcodeTree(root));
        System.out.println(TreeUtils.getLeetcodeTreeVals(treeNode));
    }
}
